how to rwite if statement in react js